<?php

namespace oceanengine;

use Psr\Http\Message\ResponseInterface;
use ShidianUtil\Api\HttpResponse;
use ShidianUtil\Api\HttpResponseTrait;

/**
 * 巨量回传响应
 * Class OceanengineResponse
 * @package oceanengine
 */
final class OceanengineResponse implements HttpResponse
{
    use HttpResponseTrait;

    private $success;
    private $decode_contents;

    public function __construct(ResponseInterface $response, bool $success, array $decode_contents = [])
    {
        $this->response = $response;
        $this->success = $success;
        $this->decode_contents = $decode_contents;
    }

    /**
     * 三方接口响应结果是否成功
     * @return bool
     */
    public function isSuccess(): bool
    {
        return $this->success;
    }

    /**
     * 获取响应体中已解析的数据
     * @return array
     */
    public function getDecodeContents(): array
    {
        return $this->decode_contents;
    }
}
